package sysuser

import (
	"context"
	"jinrigaoping/rpc/sys/sys"

	"jinrigaoping/api/superadmin/internal/svc"
	"jinrigaoping/api/superadmin/internal/types"

	"github.com/zeromicro/go-zero/core/logx"
)

type SysUserDeleteLogic struct {
	logx.Logger
	ctx    context.Context
	svcCtx *svc.ServiceContext
}

func NewSysUserDeleteLogic(ctx context.Context, svcCtx *svc.ServiceContext) *SysUserDeleteLogic {
	return &SysUserDeleteLogic{
		Logger: logx.WithContext(ctx),
		ctx:    ctx,
		svcCtx: svcCtx,
	}
}

func (l *SysUserDeleteLogic) SysUserDelete(req *types.SysUserDeleteReq) (resp *types.SysUserDeleteRes, err error) {

	_, err = l.svcCtx.SysRpc.SysUserDelete(l.ctx, &sys.SysUserDeleteReq{Id: req.Id})
	if err != nil {
		logx.Errorf("l.svcCtx.SysRpc.SysUserDelete req: %v error: %v", req, err)
		return nil, err
	}

	return &types.SysUserDeleteRes{}, nil
}
